POWER.Name = "Regeneration";
POWER.Desc = "Lets you heal very fast";

POWER.Version = 1;
POWER.Author = "Brian Nevec";

function POWER:Initialize( )
	
	hook.Add( "PlayerSpawn", "regen.PlayerSpawn", function( ... ) self:PlayerSpawn( ... ); end );
	hook.Add( "PlayerDeath", "regen.PlayerDeath", function( ... ) self:PlayerDeath( ... ); end );
	
end

function POWER:Think( )
	
	local val = self.Owner:Health( );
	val = math.Clamp( val + 5, 0, self.Owner:GetMaxHealth( ) );
	
	self.Owner:SetHealth( val );
	
	self:NextThink( CurTime( ) + 0.1 );
	
end

function POWER:PlayerSpawn( pl )
	
	if pl.PowerId == self.Id then
		
		if pl.DeathPos then
			
			pl:SetPos( pl.DeathPos );
			
		end
		
	end
	
end

function POWER:PlayerDeath( pl )
	
	if pl.PowerId == self.Id then
		
		pl.DeathPos = pl:GetPos( );
		
	end
	
end